var managerList;
$(function () {
    if($("#managerList").length>0){
        managerList = $.fn.bsgrid.init('managerList', {
            url:'../../doAdminAction.php?act=managerList',               //数据地址
            // autoLoad: false,
            pageSizeSelect: true,
            pageSize: 10,
            stripeRows: true,
            displayBlankRows:false
        });
    }
});
//manager表格相关方法
var manager={
    //表格操作
    operate:function(record, rowIndex, colIndex, options) {
        var id=managerList.getRecordIndexValue(record, 'id')
        var operate='';
        operate+='<a href="managerEdit.php?id=' + id + '">编辑</a> <a href="javascript:;" onclick="manager.del(' + id + ')">删除</a>';
        return operate;
    },
    //启用标识
    state:function(record, rowIndex, colIndex, options){
        var state=managerList.getRecordIndexValue(record, 'state');
        if(state==1) return '<span class="sui-text-success">开启</span>';
        else if(state==0) return '<span class="sui-text-disabled">关闭</span>'
    },
    //搜索
    search:function(){
        var form=$("#seach").serializeArray();
        managerList.search(form);
    },
    //删除单个用户
    del:function(id){
        table.del({
            "id":id,
            "url":'../../doAdminAction.php?act=managerDel'
        })
    },
    //删除勾选用户
    delCheck:function(){
        var ids = managerList.getCheckedValues("id");
        table.delCheck({
            "ids":ids,
            "url":'../../doAdminAction.php?act=managerDels'
        })  
    }
}
